/**
 * 
 */
package de.midnightdance.server.service;

import java.util.ArrayList;
import java.util.List;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;

import de.midnightdance.model.character.CharacterRequiemID;
import de.midnightdance.model.character.CharacterRequiemVampir;
import de.midnightdance.model.querys.RequiemQuery;
import de.midnightdance.model.querys.RequiemQueryDisziplin;
import de.midnightdance.model.user.RequiemUser;
import de.midnightdance.server.exceptions.IllegalUserException;
import de.midnightdance.server.model.RequiemModel;

/**
 * @author Surfer
 * Eigentliche Server Schnittstelle
 */

@WebService(name = "WebServiceModelRequiem", serviceName = "ServiceModelRequiem")
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class ServiceModelRequiem {
	//Exceptions seem to work here, but not in ServiceAdminRequiem
	@WebMethod
	public CharacterRequiemVampir getRequiemCharacterByID(CharacterRequiemID id,RequiemUser user)throws IllegalUserException{
		//TODO implement!
		return null;
	}
	@WebMethod
	public int addRequiemCharacter(CharacterRequiemVampir vampire, RequiemUser user){
		//TODO implement!
		return -1;
	}
	@WebMethod
	public int changeRequiemCharacter(CharacterRequiemVampir vampire, RequiemUser user){
		//TODO implement!
		return -1;
	}
	@WebMethod
	public int removeRequiemCharacter(CharacterRequiemID vampireID, RequiemUser user){
		//TODO implement!
		return -1;
	}
	@WebMethod
	public CharacterRequiemID[] executeQuery(RequiemQuery query,RequiemUser user)throws IllegalUserException{
		//TODO implement!
		//test
		List<CharacterRequiemID> resultList = new ArrayList<CharacterRequiemID>();
		if (query instanceof RequiemQueryDisziplin) {
			RequiemQueryDisziplin queryDisziplin = (RequiemQueryDisziplin) query;
			//test
			queryDisziplin.getMin();
		}else{
			//get all characterIds	
			resultList.addAll(RequiemModel.getInstance().getAllCharacters(user));
		}		 
		return resultList.toArray(new CharacterRequiemID[0]);
	}

}
